package nieflash.html {
	import flash.external.ExternalInterface;
	
	public class share {
		
		public static function sinaShare(_title:String, _pic:String = null, _url:String = null,  _video:String = null):void {
			var _shareStr:String = "http://service.weibo.com/share/share.php?c=nie&content=gb2312&source=nie";
			_title = ExternalInterface.call("encodeURIComponent", _title);
			_shareStr = _shareStr.concat("&title=" + _title);
			if (_pic != null) {
				_pic = ExternalInterface.call("encodeURIComponent", _pic);
				_shareStr = _shareStr.concat("&pic=" + _pic);
			}
			if (_video != null) {
				_video = ExternalInterface.call("encodeURIComponent", _video);
				_shareStr = _shareStr.concat("&url=" + _video);
			}else if (_url != null){
				_url = ExternalInterface.call("encodeURIComponent", _url);
				_shareStr = _shareStr.concat("&url=" + _url);
			}
			trace(_shareStr);
			ExternalInterface.call("window.open", _shareStr, "_blank", "width=700,height=600");
		}
		
		public static function qqShare(_title:String, _pic:String = null, _url:String = null,  _video:String = null):void {
			var _shareStr:String = "http://share.v.t.qq.com/index.php?c=share&a=index";
			_title = ExternalInterface.call("encodeURIComponent", _title);
			_shareStr = _shareStr.concat("&title=" + _title);
			if (_pic != null) {
				_pic = ExternalInterface.call("encodeURIComponent", _pic);
				_shareStr = _shareStr.concat("&pic=" + _pic);
			}
			if (_video != null) {
				_video = ExternalInterface.call("encodeURIComponent", _video);
				_shareStr = _shareStr.concat("&url=" + _video);
			}else if (_url != null){
				_url = ExternalInterface.call("encodeURIComponent", _url);
				_shareStr = _shareStr.concat("&url=" + _url);
			}
			ExternalInterface.call("window.open", _shareStr, "_blank", "width=700,height=600");
		}
		
		public static function qzoneShare(_title:String, _pic:String = null, _url:String = null,  _video:String = null):void {
			var _shareStr:String = "http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?summary=网易游戏";
			_title = ExternalInterface.call("encodeURIComponent", _title);
			_shareStr = _shareStr.concat("&title=" + _title);
			if (_pic != null) {
				_pic = ExternalInterface.call("encodeURIComponent", _pic);
				_shareStr = _shareStr.concat("&pics=" + _pic);
			}
			if (_video != null) {
				_video = ExternalInterface.call("encodeURIComponent", _video);
				_shareStr = _shareStr.concat("&url=" + _video);
			}else if (_url != null){
				_url = ExternalInterface.call("encodeURIComponent", _url);
				_shareStr = _shareStr.concat("&url=" + _url);
			}
			ExternalInterface.call("window.open", _shareStr, "_blank", "width=700,height=600");
		}
		
		public static function wyShare(_title:String, _pic:String = null, _url:String = null,  _video:String = null):void {
			var _shareStr:String = "http://t.163.com/article/user/checkLogin.do?check1stImg=true&togImg=true&key=OELT16LMxo0rAmtO&source=网易游戏";
			if (_pic != null) {
				_pic = ExternalInterface.call("encodeURIComponent", _pic);
				_shareStr = _shareStr.concat("&images=" + _pic);
			}
			if (_video != null) {
				_video = ExternalInterface.call("encodeURIComponent", _video);
				_shareStr = _shareStr.concat("&link=" + _video);
			}else if (_url != null){
				_url = ExternalInterface.call("encodeURIComponent", _url);
				_shareStr = _shareStr.concat("&link=" + _url);
			}
			_title = ExternalInterface.call("encodeURIComponent", _title);
			_shareStr = _shareStr.concat("&info=" + _title + _url);
			ExternalInterface.call("window.open", _shareStr, "_blank", "width=700,height=600");
		}
	}
}